package weixinkeji.dev.dc.base.scheme.combo.so;

import java.util.ArrayList;
import java.util.List;
import sys.wx.c.components.cv.CV;
import sys.wx.m.db.SQL.mysql.common.where.Where;
import sys.wx.m.db.dao.mysql.Dao;
import weixinkeji.dev.dc.base.scheme.combo.bean.Combo;
import weixinkeji.dev.dc.base.scheme.combo.bean.ComboBView;
import weixinkeji.dev.dc.base.scheme.combo.sql.ComboBSQL;

/**
 *
 * @author IMY
 */
public class ComboBSO {

    public static List<ComboBView> selectAll(String combo_id) {

        return Dao.selectVast_My(ComboBView.class, ComboBSQL.SQL_ComboBView_IN.replace(ComboBSQL.COMBO_ID, CV.toSQLStringValue(combo_id)));
    }

    public static List<ComboBView> selectByFL(String combofl_id) {
        List<Combo> list = Dao.selectVast(Combo.class, Where.putIN(Where.TJ_IGNORE_NOTHING, null, "", "flid", CV.toSQLStringValue(combofl_id)));
        StringBuilder combo_id = new StringBuilder();
        for (Combo obj : list) {
            combo_id.append(",'").append(obj.getCombo_id()).append("'");
        }
        return list.isEmpty() ? new ArrayList<>() : Dao.selectVast_My(ComboBView.class, ComboBSQL.SQL_ComboBView_IN.replace(ComboBSQL.COMBO_ID, combo_id.substring(1)));
    }
}
